/**
 * 
 */
package com.neal.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.neal.domain.shopping.Product;
import com.neal.service.IProduceService;

/**
 * @author Neal
 * @version 1.0
 * @description
 */
@Service("productService")
public class ProduceServiceBean implements IProduceService {

	private Map<String, Product> products = new HashMap<String, Product>();

	public ProduceServiceBean() {
		products.put("B000", new Product("B000", "商品1", 1000));
		products.put("C111", new Product("C111", "商品2", 1500));
		products.put("D222", new Product("D222", "商品3", 2000));
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.neal.service.IProduceService#getProducts()
	 */
	@Override
	public List<Product> getProducts() {
		return new ArrayList<Product>(products.values());
	}

	/* (non-Javadoc)
	 * @see com.neal.service.IProduceService#getProductByCode(java.lang.String)
	 */
	@Override
	public Product getProductByCode(String code) {
		return products.get(code);
	}

}
